package com.mali.malibackendlog.controller;

import com.mali.backendcommon.common.Result;
import com.mali.malibackendlog.service.OperationService;
import com.mali.malibackendmodel.pojo.Operation;
import com.mali.malibackendmodel.vo.OperationVO;
import com.mali.malibackendmodel.vo.PageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author:吴键霏
 * @Date：2024/6/18 15:54
 * @Version 1.0
 */
@RestController
@RequestMapping("/log")
@CrossOrigin(origins = "*", allowedHeaders = "*")
public class OperationController {
    @Autowired
    private OperationService operationService;
    @GetMapping("/{page}/{size}/{productId}")
    Result<PageVO<OperationVO>> getProductLog(@PathVariable("page")Long page, @PathVariable("size")Long size,
                                              @PathVariable("productId")Long productId){
        if (page==null){
            page=1L;
        }
        if (size==null){
            size=5L;
        }
        return operationService.getLog(page,size,productId);
    }
}
